﻿using System.Collections;
using System.Collections.Generic;
using FastDev;
using UnityEngine;
using UnityEngine.UI;

public class AudioExample : MonoBehaviour
{
    public Slider slider;
    public Button bt;
    public Button bt2;
    void Start()
    {
        slider.value = AudioManager.Instance.VolumeSetting.TotalVolume;
        // AudioManager.Instance.PlayMusic("Assets/Example/2.Audio/textclip.mp3");

        slider.onValueChanged.AddListener((UnityEngine.Events.UnityAction<float>)((a) =>
        {
            AudioManager.Instance.VolumeSetting.TotalVolume = a;
        }));

        bt.onClick.AddListener(() =>
        {
            Vector3 pos = new Vector3(Random.Range(-10, 10), Random.Range(-10, 10), Random.Range(-10, 10));
            AudioManager.Instance.PlayAtPosition(pos,"Assets/Example/2.Audio/pick.mp3");

        });

        bt2.onClick.AddListener(() =>
        {
            AudioSource audioSource = AudioManager.Instance.GetAudioSource("Default");
            AudioManager.Instance.PlayOneShot(audioSource,"Assets/Example/2.Audio/pick.mp3");
        });
    }
}
